<?php $this->load->view('config/header_home');?>
<h2>Penandatangan</h2>
<div class="line-separtor"></div>
<br/>
	<?php if(@$results[0]['jml_penandatangan'] < 2 ):?>
		<a href="<?php echo site_url()?>penandatangan/add" class="btn btn-primary"> Penandatangan baru </a>
	<?php else:?>
		<a href="#" class="btn btn-primary" disabled="true"> Penandatangan baru </a>
	<?php endif;?>
	
	<!--<?php if(@$pihak[0]['jml_pihakpenandatangan'] != 1 ):?>
		<a href="<?php echo site_url()?>penandatangan/addpihaklain" class="btn btn-primary"> Disampaikan kepada </a>
	<?php else:?>
		<a href="#" class="btn btn-primary" disabled="true"> Disampaikan kepada</a>
	<?php endif;?> -->
	
	<div class="input-append" id="search">
		<form method="post" class="form-horizontal" action="<?php echo site_url() ?>penandatangan/searchData" >
			<input class="span3" id="appendedInputButtons" name="name" type="text">
			<input type="submit" name="submit" value="Search" class="btn" />
		</form>
	</div>
<br/>
<br/>
<br/>	
	<?php $success = $this->session->flashdata('success');?>
	<?php if ($success):?>
		<div class="alert alert-success">
			Data telah tersimpan
		</div>
	<?php endif?>
	
	<?php $error = $this->session->flashdata('error');?>
	<?php if ($error):?>
		<div class="alert alert-error">
			Data gagal tersimpan
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('delete');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data telah terhapus
		</div>
	<?php endif?>
<br/>
<table class="table table-condensed table-hover">
	<thead>
		<th>#</th>
		<th>Nama penandatangan</th>
		<th>Posisi penandatangan</th>
		<th>Aksi</th>
	</thead>
	<tbody>
	<?php if (@$results):?>
		<?php $i=1;?>
		<?php foreach ($results as $row):?>
		<?php if($row['is_disampaikan'] == 1 ):?>
			<tr>
				<td><?php echo $i;?></td>
				<td><?php echo $row['nama_penandatangan']?></td>
				<td>
					<?php if($row['posisi_penandatangan']==1):?>
						Posisi Kiri
					<?php else:?>
						Posisi Kanan
					<?php endif;?>
				</td>
				<td>
					<a href="<?php echo site_url()?>penandatangan/edit/<?php echo $row['id_penandatangan']?>" class="icon-edit"></a>&nbsp;
					<a href="<?php echo site_url()?>penandatangan/delete/<?php echo $row['id_penandatangan']?>" class="icon-trash" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
				</td>
			</tr>
		<?php else:?>
			<tr>
				<td colspan="4" style="padding-top:30px"><b>Disampaikan kepada</b></td>
			</tr>
			<tr>
				<td><?php echo $i;?></td>
				<td><?php echo $row['nama_penandatangan']?></td>
				<td>-</td>
				<td>
					<a href="<?php echo site_url()?>penandatangan/editpihaklain/<?php echo $row['id_penandatangan']?>" class="icon-edit"></a>&nbsp;
					<a href="<?php echo site_url()?>penandatangan/delete/<?php echo $row['id_penandatangan']?>" class="icon-trash" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
				</td>
			</tr>
		<?php endif;?>
		<?php $i++;?>
		<?php endforeach?>
	<?php else:?>
		<tr>
			<td colspan="4">
				<br/>
				<div class="alert alert-error" style="text-align:center">
					Tidak ada record
				</div>
			</td>
		</tr>
	<?php endif?>
	</tbody>
</table>
<?php $this->load->view('config/footer_home');?>